<?php
/*
 * Created on Mar 9, 2010
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
?>
<?php 
$subsidiaries = array();
if(!empty($nav)){
	for($i = 0; $i < count($nav); $i++){
		if(!empty($nav[$i]['css_class'])){
			$subsidiaries = $nav[$i];
			unset($nav[$i]);
			break;
		}
	}
}
?>
<div class="left-2-col texture">
</div>
<div class="col_center" id="page_search">
	<h2><?=$this->lang->line("sitemap")?></h2>
	<!-- Subsidiaried -->
	<?php if(!empty($subsidiaries)): $subsidiaries = $subsidiaries['children'];$i = 0;?>		
	<div class="sitemap-subsidiary">
		<?php foreach($subsidiaries as $key => $val):?>		
		<?php
			$target =  isset($external_link[$val['target']]) ? $external_link[$val['target']]['val'] : "_self";
			$method = isset($external_link[$val['target']]) ? $external_link[$val['target']]['method'] : "index";
			$link = empty($val['link']) ? site_url(array("c"=>"home", "m" => $method, "node_id" => $val['id'], "url_title" => $val['url_title'])) : htmlspecialchars($val['link']);
		?>
		<div class="item">
			<span><?=$val['description'];?></span>
			<span><a href="<?=$link?>" target="<?=$target?>" rel="<?=htmlentities($val['nav_name'])?>" title="<?=htmlspecialchars($val['nav_name'])?>"><?=htmlspecialchars($val['nav_name'])?></a></span>
			<?php $j = 0;if(isset($val['children'])):?>
			<ul>
			<?php foreach($val['children'] as $key1 => $val1): $j++;?>
				<?php
					$target =  isset($external_link[$val1['target']]) ? $external_link[$val1['target']]['val'] : "_self";
					$method = isset($external_link[$val1['target']]) ? $external_link[$val1['target']]['method'] : "index";
					$link = empty($val1['link']) ? site_url(array("c"=>"home", "m" => $method, "node_id" => $val1['id'], "url_title" => $val1['url_title'])) : htmlspecialchars($val1['link']);
				?>
				<li>
					<span><a href="<?=$link?>" target="<?=$target?>" rel="<?=htmlentities($val1['nav_name'])?>" title="<?=htmlspecialchars($val1['nav_name'])?>"><?=htmlspecialchars($val1['nav_name'])?></a></span>
				</li>
			<?php endforeach;?>
			</ul>
			<?php endif;?>
		</div>
		<?php if((($i != 0) && ($i % 3 == 2)) || ($i+1==count($subsidiaries))):?>		
		<div class="clearfix"></div>
		<?php endif;?>
		<?php $i++; endforeach;?>
	</div>
	<?php endif;?>	
	<div class="clearfix"></div>
	<h2><?=$this->lang->line("about.esaco")?></h2>
	<!-- End Subsidiaried -->	
	<div class="sitemap">
	<?php if(!empty($nav)): $i = 0;?>
		<?php foreach($nav as $key => $val):?>
		<div class="item">
			<?php
				$class=$node['id']==$val['id']?'selected':'';
				$target =  isset($external_link[$val['target']]) ? $external_link[$val['target']]['val'] : "_self";
				$method = isset($external_link[$val['target']]) ? $external_link[$val['target']]['method'] : "index";
				$link = empty($val['link']) ? site_url(array("c"=>"home", "m" => $method, "node_id" => $val['id'], "url_title" => $val['url_title'])) : htmlentities($val['link']);
			?>
			<span><a href="<?=site_url(array("c"=>"home", "m" => $method, "node_id" => $val['id']))?>" title="<?=htmlentities($val['nav_name'])?>" class="text <?=$class?>"><?=htmlspecialchars($val['nav_name'])?></a></span>
			<?php $j = 0;if(isset($val['children'])):?>
				<ul>
				<?php foreach($val['children'] as $key1 => $val1): $j++;?>
					<li <?=count($val['children'])==$j?"class='last'":""?>>
					<?php
						$target =  isset($external_link[$val1['target']]) ? $external_link[$val1['target']]['val'] : "_self";
						$method = isset($external_link[$val1['target']]) ? $external_link[$val1['target']]['method'] : "index";
						$link = empty($val1['link']) ? site_url(array("c"=>"home", "m" => $method, "node_id" => $val1['id'], "url_title" => $val1['url_title'])) : htmlspecialchars($val1['link']);
					?>
					<span><a href="<?=$link?>" target="<?=$target?>" rel="<?=htmlentities($val1['nav_name'])?>" title="<?=htmlspecialchars($val1['nav_name'])?>"><?=htmlspecialchars($val1['nav_name'])?></a></span>				
				</li>
				<?php endforeach;?></ul>
			<?php endif;?>
		</div>
		<?php if((($i != 0) && ($i % 3 == 2)) || ($i+1==count($nav))):?>		
			<div class="clearfix"></div>
		<?php endif;?>
		<?php  $i++;endforeach;?>
	<?php endif;?>
	</div>
</div>